﻿@model AutomatedTestDataManagement.Models.TestStep

@{
    ViewBag.Title = "Create";
}

<h2>Create Test Step</h2>

@using (Html.BeginForm("CreatePartial", "TestStep", null, FormMethod.Post, null))
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>TestStep</legend>

        <div class="editor-label">
            @if (ViewBag.TestID != null)
            {
                <input type="hidden" id="TestID" name="TestID" value="@ViewBag.TestID" />
            }

            @if (ViewBag.ScenarioID != null)
            {
                <input type="hidden" id="ScenarioID" name="ScenarioID" value="@ViewBag.ScenaroID" />
            }

            @if (ViewBag.SuiteID != null)
            {
                <input type="hidden" id="SuiteID" name="SuiteID" value="@ViewBag.SuiteID" />
            }
            @Html.Label("Description")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.StepDescription)
            @Html.ValidationMessageFor(model => model.StepDescription)
        </div>

        <div class="editor-label">
            @Html.Label("Step Kind")
        </div>
        <div class="editor-field">
            @Html.DropDownList("StepKindID", ViewBag.StepKindID as SelectList, string.Empty, new { onchange = "FetchData();"} ) 
            @Html.ValidationMessageFor(model => model.StepKindID)
        </div>

            <div class="editor-label">
                @Html.Label("Linked Data Record")
            </div>
            <div>
                <select id="DataID" name="DataID" data-bind="options: DataID, optionsText: 'Value', optionsValue: 'Text', optionsCaption: ' -- Please select a test step -- '">
                </select>
                @Html.ValidationMessageFor(model => model.StepKindID)
            </div>
        <p>
            <input type="submit" value="Create" />
        </p>
    </fieldset>
}

<div>
    @if (ViewBag.TestID != null)
    {
        if (ViewBag.ScenarioID != null)
        {
            if (ViewBag.SuiteID != null)
            {
                @Html.ActionLink("Return to Test", "Edit", "Test", new { id = ViewBag.TestID, scenarioID = ViewBag.ScenarioID, suiteID = ViewBag.SuiteID }, null) @Html.Encode(" | ")
            }
            else
            {
                @Html.ActionLink("Return to Test", "Edit", "Test", new { id = ViewBag.TestID, scenarioID = ViewBag.ScenarioID }, null) @Html.Encode(" | ")
            }
        }
        else
        {
           @Html.ActionLink("Return to Test", "Edit", "Test", new { id = ViewBag.TestID }, null) @Html.Encode(" | ")
        }
    }
    @Html.Partial("_TestSuiteNav")
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
